import QtQuick 2.12
import QtQuick3D 1.0
import QtQuick.Controls 2.12
//import Qt3D.Render 2.14
// reference to https://blog.csdn.net/gongjianbo1992/article/details/106744754

// it must first be flattened.
View3D {
    id: view

    //SceneEnvironment
    environment: SceneEnvironment {
        clearColor: "darkGreen"
        backgroundMode: SceneEnvironment.Color
    }

    // a Camera
    PerspectiveCamera {
        position: Qt.vector3d(0, 0, 300)
    }

    /*
    // light
    DirectionalLight{
        worldDirection.x: -100
        worldDirection.y: -100
        worldDirection.z: 500
    }
    */

    // a Sphere
    Model {
        position: Qt.vector3d(0, 0, 0)
        source: "#Sphere"
        materials: [ DefaultMaterial {
                diffuseColor: "blue"
            }
        ]
    }

    //rectangle
    Model {
        position: Qt.vector3d(-100, -100, 0)
        source: "#Cube"
        scale: Qt.vector3d(2, 0.1, 1)
        //eulerRotation: Qt.vector3d(0,0,-20)
        materials: [ DefaultMaterial {
                diffuseColor: "red"
            }
        ]
    }
}

/*##^##
Designer {
    D{i:0;3d-view:false;autoSize:true;height:480;width:640}
}
##^##*/
